#ifndef __WINDOWS_H__
#define __WINDOWS_H__

#include "user_extern.h"

enum windows_id
{
    /* 1级菜单 */
    WIN_UI_DESKTOP, /* 00 时间界面 */
    WIN_UI_WEATHER, /* 01 显示天气 */
    WIN_UI_SETTING, /* 02 设置 */
    WIN_UI_DIGIMON, /* 03 数码宝贝 */
    WIN_UI_OTHERMO, /* 04 其他所有界面 */
};

enum windows_subid
{
    /* 2级菜单 */
    WIN_SUI_SETTING_WIFI,    /* 03 设置-连接wifi */
    WIN_SUI_SETTING_TIME,    /* 04 设置时间 */
    WIN_SUI_SETTING_LIGHT,   /* 05 设置-节能调节 */
    WIN_SUI_SETTING_TONE,    /* 06 设置系统音效 */
    WIN_SUI_SETTING_WEATHER, /* 07 设置-天气设置 */
    WIN_SUI_SETTING_OTA,     /* 08 OTA */
    WIN_SUI_SETTING_STATUS,  /* 09 系统状态 */
    WIN_SUI_WEATHER_MORE,    /* 10 显示天气详细信息 */

    /* 3级菜单 */
    WIN_SUI_SETTING_TIME_TIME,  /* 11 设置时间 */
    WIN_SUI_SETTING_TIME_ALARM, /* 12 设置闹钟 */

    /* 向导 */
    WIN_SUI_WIZARD_INIT,
    WIN_SUI_WIZARD_WIFI,
    WIN_SUI_WIZARD_LOCAL,

    /* DIGIMON */
    //WIN_SDIGI_MENU0_NORMAL,       /* 普通界面 */
    WIN_SDIGI_MENU1_INFO,     /* 信息界面 */
    WIN_SDIGI_MENU2_EAT,      /* 进食界面 */
    WIN_SDIGI_MENU3_TRAINING, /* 训练界面 */
    WIN_SDIGI_MENU4_AIBAT,    /* 模拟战斗界面 */
    WIN_SDIGI_MENU5_CLEAN,    /* 清洁界面 */
    WIN_SDIGI_MENU6_LIGHT,    /* 开关灯界面 */
    WIN_SDIGI_MENU7_HEALTH,   /* 治疗界面 */
    WIN_SDIGI_MENU8_DATABASE, /* 数据库界面 */
};

enum windows_status
{
    WINDOWS_STATUS_INIT,     /* init + display */
    WINDOWS_STATUS_DIS_ONLY, /* display */
    WINDOWS_STATUS_NONE,     /* none */
    WINDOWS_STATUS_DESTORY,  /* 窗口销毁 */
};

void win00_desktop_init(void);
void win01_weather_init(void);
void win02_setting_init(void);
void win03_digimon_init(void);
void win04_othermo_init(void);

uint8_t win5_setting_wifi_display(void);
uint8_t win5_setting_wifi_btn_select(void *arg);
uint8_t win5_setting_wifi_btn_enter(void *arg);
uint8_t win5_setting_wifi_btn_exit(void *arg);

uint8_t win6_setting_time_display(void);
uint8_t win6_setting_time_btn_select(void *arg);
uint8_t win6_setting_time_btn_enter(void *arg);
uint8_t win6_setting_time_btn_exit(void *arg);

uint8_t win7_setting_light_display(void);
uint8_t win7_setting_light_btn_select(void *arg);
uint8_t win7_setting_light_btn_enter(void *arg);
uint8_t win7_setting_light_btn_exit(void *arg);

uint8_t win8_setting_tone_display(void);
uint8_t win8_setting_tone_btn_select(void *arg);
uint8_t win8_setting_tone_btn_enter(void *arg);
uint8_t win8_setting_tone_btn_exit(void *arg);

uint8_t win9_setting_weather_display(void);
uint8_t win9_setting_weather_btn_select(void *arg);
uint8_t win9_setting_weather_btn_enter(void *arg);
uint8_t win9_setting_weather_btn_exit(void *arg);

uint8_t win10_setting_ota_display(void);
uint8_t win10_setting_ota_btn_enter(void *arg);
uint8_t win10_setting_ota_btn_exit(void *arg);

uint8_t win11_setting_status_display(void);
uint8_t win11_setting_status_btn_select(void *arg);
uint8_t win11_setting_status_btn_enter(void *arg);
uint8_t win11_setting_status_btn_exit(void *arg);

uint8_t win12_setting_time_time_display(void);
uint8_t win12_setting_time_time_btn_select(void *arg);
uint8_t win12_setting_time_time_btn_enter(void *arg);
uint8_t win12_setting_time_time_btn_exit(void *arg);

uint8_t win12_setting_time_alarm_display(void);
uint8_t win12_setting_time_alarm_btn_select(void *arg);
uint8_t win12_setting_time_alarm_btn_enter(void *arg);
uint8_t win12_setting_time_alarm_btn_exit(void *arg);


uint8_t win13_wizard_display(void);
uint8_t win13_wizard_btn_select(void *arg);
uint8_t win13_wizard_btn_enter(void *arg);
uint8_t win13_wizard_btn_exit(void *arg);

void win14_wizard_create(void);
uint8_t win14_wizard_wifi_display(void);

uint8_t win15_wizard_local_display(void);
uint8_t win15_wizard_btn_select(void *arg);
uint8_t win15_wizard_btn_enter(void *arg);
uint8_t win15_wizard_btn_exit(void *arg);

uint8_t digi01_info_display(void);
uint8_t digi01_info_btn_select(void *arg);
uint8_t digi01_info_btn_enter(void *arg);
uint8_t digi01_info_btn_exit(void *arg);

uint8_t digi02_eat_display(void);
uint8_t digi02_eat_btn_select(void *arg);
uint8_t digi02_eat_btn_enter(void *arg);
uint8_t digi02_eat_btn_exit(void *arg);

uint8_t digi03_train_display(void);
uint8_t digi03_train_btn_select(void *arg);
uint8_t digi03_train_btn_enter(void *arg);
uint8_t digi03_train_btn_exit(void *arg);

uint8_t digi04_battle_display(void);
uint8_t digi04_battle_btn_select(void *arg);
uint8_t digi04_battle_btn_enter(void *arg);
uint8_t digi04_battle_btn_exit(void *arg);

uint8_t digi05_clean_display(void);

uint8_t digi06_sleep_display(void);
uint8_t digi06_sleep_btn_select(void *arg);
uint8_t digi06_sleep_btn_enter(void *arg);
uint8_t digi06_sleep_btn_exit(void *arg);

uint8_t digi07_health_display(void);
uint8_t digi07_health_btn_select(void *arg);
uint8_t digi07_health_btn_enter(void *arg);
uint8_t digi07_health_btn_exit(void *arg);

uint8_t digi08_database_display(void);
uint8_t digi08_database_btn_select(void *arg);
uint8_t digi08_database_btn_enter(void *arg);
uint8_t digi08_database_btn_exit(void *arg);

typedef struct _windows
{
    uint8_t id;
    uint8_t fa_id;
    uint8_t son_id[10];
    char name[16];
    uint8_t win_status; /* 记录该窗口的运行状态 0：更新init+display 1:仅更新display 2：不更新*/

    uint8_t (*run)(void);
    void (*update_screen)(void);
    uint8_t (*Dselect)(void *arg);
    uint8_t (*enter)(void *arg);
    uint8_t (*exit)(void *arg);
} Windows;

typedef struct _win_init
{
    void (*init)(void);
} Win_init;

extern Windows *windows;
void init_windows(void);

#endif